home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / comm / term / ncomm30.lha / NComm / Scripts / random.script < prev    next >
Text File  |  1993-09-25  |  417b  |  15 lines

  1. ;NComm script that demonstrates the $RAND variable
  2.  
  3. set $range = "15"    ;Generate a random number between 0 and 15
  4.                         ;Actual result will be placed in the $newrand variable
  5.  
  6. main:
  7.     gosub rand
  8.     message "Your lucky number is: "$newrand"\n"
  9.     end
  10.  
  11. rand:    ;To generate a new random number, gosub to this routine
  12.     set $newrange = $range+"1"#
  13.         set $newrand = $rand*$newrange/"65536"#
  14.         return
  15.